const WXAPI = require('../../utils/apifm-wxapi');
WXAPI.init('hejiang');
Page({
  data: {
    userInfo:null,
    list:[
      {"name":"余额","pir":"0"},
      {"name":"冻结","pir":"0"},
      {"name":"积分","pir":"0"},
      {"name":"成长值","pir":"0"},
    ],
    list2:[
      {"name":"待付款","pir":"../../images/order/topay.png",status: '1'},
      {"name":"待发货","pir":"../../images/order/fahuo.png",status: '2'},
      {"name":"待收货","pir":"../../images/order/shouhuo.png",status: '3'},
      {"name":"待评价","pir":"../../images/order/pj.png",status: '4'},
      {"name":"售后","pir":"../../images/order/shouhou.png",status: '5'},
    ],
    gender:'0',
    // token:wx.getStorageSync('token')
  },
  getUserInfo(e){
    
    this.setData({
      userInfo:e.detail.userInfo
    })
    this.onLaunch()
    this.setData({    //微信小程序全局刷新
      jobListData: this.data.jobListData
    })
  },
  onLoad: function (options) {

  },
  onLaunch:function(){                               //获取app.js页面在本地存储的code 获取token
    var code=wx.getStorageSync('code')
    if (code) {
      WXAPI.login_wx(code).then(res2=>{
        wx.setStorageSync('uid',res2.data.uid);
        wx.setStorageSync('token',res2.data.token);
        console.log(res2);
      })
    }
  },
  quit(){
    wx.setStorageSync('token',"");
    this.setData({
      jobListData: this.data.jobListData
    })
  },
  onReady: function () {    //生命周期函数--监听页面初次渲染完成

  },
  onShow: function () {   //生命周期函数--监听页面显示

  },
  onHide: function () {     //生命周期函数--监听页面隐藏

  },
})